//
//  ACELoginOrRegistViewController.m
//  ACE
//
//  Created by zhangtao on 2018/8/7.
//  Copyright © 2018年 zt.td. All rights reserved.
//

#import "ACELoginOrRegistViewController.h"
#import "ACELoginNavView.h"
#import "ACELoginViewController.h"
#import "ACERegistViewController.h"
@interface ACELoginOrRegistViewController ()

@end

@implementation ACELoginOrRegistViewController
{
    UIView *infoView;
    ACELoginViewController *loginController;
    ACERegistViewController *registController;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    
    
    ACELoginNavView *nav = [[ACELoginNavView alloc]initWithFrame:CGRectMake(0, statusBarHeight, ACEWidth, 60)];
    nav.loginOrRegistChangeCallBack = ^(NSInteger tag) {
        if (tag == 0) {
            self.registController.view.hidden = YES;
            self.loginController.view.hidden = NO;
        }else{
            self.loginController.view.hidden = YES;
            self.registController.view.hidden = NO;
        }
    };
    
    
    [self.view addSubview:nav];

    infoView = [[UIView alloc]initWithFrame:CGRectMake(0, navHeight+60, ACEWidth, ACEHeight)];
    [self.view addSubview:infoView];
    [infoView addSubview:self.registController.view];
    [infoView addSubview: self.loginController.view];
    
}

-(ACERegistViewController *)registController{
    if (!registController) {
        registController = [[ACERegistViewController alloc]initWithNibName:@"ACERegistViewController" bundle:nil];
    }
    return registController;
}

-(ACELoginViewController *)loginController{
    if (!loginController) {
        loginController = [[ACELoginViewController alloc]initWithNibName:@"ACELoginViewController" bundle:nil];
    }
    return loginController;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
